<!DOCTYPE html>
<html>

	<head lang="en">
		<meta charset="UTF-8">
		<title>上传文件</title>
		<style>
			#main {
				margin: 0 auto;
				width: 500px;
			}
			
			dl {
				clear: both;
				width: 100%;
			}
			
			dt {
				float: left;
				width: 100px;
				text-align: right;
			}
		</style>
		<script>
			function add(l) {
				var fa = document.getElementById("main");
				var fa2 = document.createElement("dl");

				var ddt = document.createElement("dt");
				var txt = document.createTextNode("文件路径：");
				ddt.appendChild(txt);

				var ddd = document.createElement("dd");
				var inp = document.createElement("input");
				inp.setAttribute("name", "fileImages");
				inp.setAttribute("type", "file");
				ddd.appendChild(inp);

				fa2.appendChild(ddt);
				fa2.appendChild(ddd);
				//							fa.appendChild(fa2);
				fa.insertBefore(fa2, l.parentNode);
				//							fa.insertBefore(fa2,fa.childNodes(0));
			}
//			function add(l){
//				var son = document.getElementById("upload");
//				var sons=son.cloneNode(true);
//				var fa=document.getElementById("main");
//				fa.insertBefore(sons,l.parentNode);
//			}
		</script>
	</head>

	<body>
		<div id="main">
			<dl id="upload">
				<dt>文件路径：</dt>
				<dd><input name="fileImages" type="file" /></dd>
			</dl>
			<div id="addBtn"><input id="up" type="button" value="再上传一个文件" onclick="add(this)" /></div>
		</div>

	</body>

</html>